package com.neuedu.hisadmin.service.impl;

import ch.qos.logback.core.util.StringUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.neuedu.hisadmin.entity.Customer;
import com.neuedu.hisadmin.mapper.CustomerMapper;
import com.neuedu.hisadmin.service.ICustomerService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author jaun
 * @since 2025-07-05
 */
@Service
public class CustomerServiceImpl extends ServiceImpl<CustomerMapper,
        Customer> implements ICustomerService {

    @Override
    public List<Customer> getCustomerByNameOrNumber(String name, String number) {
        QueryWrapper<Customer> queryWrapper = new QueryWrapper<>();
        //构造查询条件
        if(StringUtils.hasText(name)){
            queryWrapper.like("realName",name);
        }
        if(StringUtils.hasText(number)){
            queryWrapper.like("idnumber",number);
        }
        queryWrapper.eq("delMark",1);
        return this.list(queryWrapper);
    }
}
